package com.atguigu.ssyx.controller;

//import com.atguigu.ssyx.result.ZhgjResult;
//import com.atguigu.ssyx.service.CheckService;
import com.atguigu.ssyx.model.ZhgjResponse;
import com.atguigu.ssyx.service.CheckService;
import com.atguigu.ssyx.service.OpenGateService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/ext_api/cluster/center/api")
@Api(tags = "核验管理")
@CrossOrigin
public class CheckController {

    @Autowired
    private CheckService checkService;
    @Autowired
    private OpenGateService openGateService;

    @ApiOperation("二维码核验")
    @PostMapping("/checkCode")
    public ZhgjResponse openGateByQrCode(String qrCodeUrl,Integer sn,Integer gateNo) {
        ZhgjResponse response = checkService.openGateByQrCode(qrCodeUrl,sn,gateNo);
        return response;
    }

    @ApiOperation("开门")
    @PostMapping("/openGate")
    public void openGate(Integer sn, Integer gateNo) {
        openGateService.openGate(sn, gateNo);
    }
}
